<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改产品</title>
<script language="javascript">
<!--
function check(form){
	if(form.name.value==""){
		alert("名称不能为空！");
		form.name.focus();
		return false;
	}
	/*
    if(form.photo.value==""){
		alert("请选择要上传的产品图片！");
		form.photo.focus();
		return false;
	}
	*/
	form.submitbutton.disabled = true;
	return true;
}

function deletePhoto(i){
    if (!confirm('确定要删除此图片？')) {
        return ;
    }
    var id = <?=intval($this->data['g_products']['g_id'])?>;
	var url = "<?php echo SystemProperties::$app_host;?>/product/deletePhoto"+'/'+id+'/'+i;
	doPost(url,'','');	
	document.getElementById('productPhoto'+i).innerHTML = '无';
}



//-->
</script>
</head>

<body>
<table border="0" align="center" cellpadding="0" cellspacing="1" class="navi">
  <tr>
    <th>当前位置：<?php echo $product_title;?></th>
  </tr>
</table>
<br />
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo SystemProperties::$app_host.$product_action;?>" onSubmit="return check(this);">
  <table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
    <tr>
      <th colspan="2"><?php echo $product_title;?>
      <input type="hidden" name="data[g_products][g_id]" value="<?php echo $this->data['g_products']['g_id']?>"/>
      </th>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">名称：</td>
      <td><?php echo $form->text('g_products.g_name',array('maxlength'=>'128','style'=>'width:300px')); ?></td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">分类：</td>
      <td><?php echo $form->select('g_products.g_cat',SystemProperties::$catname); ?></td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">产品发放类型：</td>
      <td>
      <?php if (empty($this->data['g_products']['g_id'])) { ?>
          <?php echo $form->select('g_products.type',SystemProperties::$p_types); ?>(<b>仅用于新版，必填</b>)
      <?php } else { ?>
            <?=SystemProperties::$p_types[$this->data['g_products']['type']]?>
            <input type="hidden" name="data[g_products][type]" value="<?=$this->data['g_products']['type']?>">
      <?php } ?>
      </td>
    </tr>    
	 <tr>
      <td width="20%" height="25" align="right">显示市场价：</td>
      <td><?php echo $form->text('g_products.g_jiazhi',array('maxlength'=>'128')); ?></td>
    </tr>

	 <tr>
      <td width="20%" height="25" align="right">人气：</td>
      <td><?php echo $form->text('g_products.popularity',array('maxlength'=>'128')); ?></td>
    </tr>
     <tr>
      <td width="20%" height="25" align="right">热度(1为最热产品)：</td>
      <td><?php echo $form->text('g_products.g_hot',array('maxlength'=>'128')); ?></td>
    </tr>

    <tr>
      <td width="20%" height="25" align="right">基准第一期开始时间（除非发布前更改，其他情况请不要随意修改，以免打乱数据，不可以是未来的时间）：</td>
      <td>
      <?php if ($this->data['g_products']['g_id'] > 0) { ?>
          <?php echo $form->text('g_products.g_timestart',array('maxlength'=>'128')); ?></td>
      <?php } else { ?>
           当前时间
      <?php } ?>

      </tr>
	<tr>
      <td width="20%" height="25" align="right">每期申领周期(分钟为单位)，每期有用户获奖（除非发布前更改，其他情况请不要随意修改，以免打乱数据)：</td>
      <td><?php echo $form->text('g_products.g_timesplit',array('maxlength'=>'128')); ?>分钟</td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">剩余数量：</td>
      <td><?php echo $form->text('g_products.g_number',array('maxlength'=>'128')); ?></td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right"><span style="color:red">注意</span></td>
      <td><span style="color:red">[库存数量必须为每期送出数量的整数倍，否则无法正常送出]
      <br />[库存不能直接设置为0，并且至少要达到当期赠送数量]
      <br />[如果当期还在进行，请不要修改起始时间、时间间隔。必须等当期结束、库存消耗完毕再修改。]
      
      </span></td>
    </tr> 
<?php if (SystemProperties::$platform=='ruuenren') { ?>
    <tr>
      <td width="20%" height="25" align="right">每期送出数量：</td>
      <td><?php echo $form->text('g_products.num_per_time',array('maxlength'=>'128')); ?></td>
    </tr>
  <?php } else { ?>
    
	<tr>
      <td width="20%" height="25" align="right">每期幸运数<br />(每期第几个获奖)：</td>
      <td><?php echo $form->text('g_products.g_lucknum',array('maxlength'=>'128')); ?></td>
    </tr>
    <?php } ?>
    
    <?php 
    $data = SystemProperties::$img_names;    
    foreach ($data as $n=>$da){?>    
    <tr>
      <td height="25" align="right"><?=$n==0?'产品列表图片(160X160)':'产品介绍图'.$n?>：<br /><b>仅支持gif/jpeg/png</b></td>
      <td>
      <?php if (empty($this->data['g_products'][$da])) { ?>
      无<br />
      <?php } else { ?>
      <div id='productPhoto<?=$n?>'>
      <img src="<?=SystemProperties::$path.$this->data['g_products'][$da]?>" width="80" height="60" />
      <?php if ($n>0) { ?>
      <a href="javascript:deletePhoto(<?=$n?>)">删除图片</a>
      <?php } ?>
      <br />
      
      </div>
      <?php } ?>
      <?php echo $form->file('g_products.g_img'.$n); ?></td>
    </tr>
    <?php } ?>
    
    
    <tr>
      <td width="20%" height="25" align="right">是否100%优惠码发放产品：</td>
      <td>    
      此项已经合并至商品类型，商品类型选择“优惠码”即可。<br />
      (如勾选此项，请注意稍后从管理列表进入优惠码管理页面进行优惠码添加）
      
      </td>
    </tr>

    
    <tr>
      <td width="20%" height="25" align="right">是否广告点击商品：</td>
      <td>
      <?php if ($this->data['g_products']['g_id'] > 0) { ?>
          <?=($this->data['g_products']['is_ad_link'] == 1)?'是':'否'?>
          <input type="hidden" name="data[g_products][is_ad_link]" value="<?php echo $this->data['g_products']['is_ad_link']?>"/>
      <?php } else { ?>
          <?php echo $form->checkbox('g_products.is_ad_link'); ?>
          (如勾选此项，则必填下列网址）
      <?php } ?>
      </td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">产品网站地址(用于广告地址或优惠码官方地址,以http://开头)：</td>
      <td><?php echo $form->text('g_products.g_protal_url',array('maxlength'=>'256','style'=>'width:300px')); ?></td>
    </tr>
    <tr>
      <td width="20%" height="25" align="right">附加商城立即领取<br />淘宝快递费地址<br />(以http://开头)：</td>
      <td><?php echo $form->text('g_products.g_extra_url',array('maxlength'=>'256','style'=>'width:300px')); ?></td>
    </tr>
    <?php if (SystemProperties::$platform=='renren') { ?>
    <tr>
      <td width="20%" height="25" align="right">人人新鲜事自定义标题：</td>
      <td><?php echo $form->text('g_products.feed_word_title',array('maxlength'=>'256','style'=>'width:300px')); ?>
      </td>
    </tr>
    <?php } ?>
    <tr>
      <td width="20%" height="25" align="right">新鲜事自定义内容<br />(<b>视平台情况使用</b>)：</td>
      <td><?php echo $form->text('g_products.feed_word',array('maxlength'=>'256','style'=>'width:300px')); ?>
      </td>
    </tr>    

    
    <tr>
      <td width="20%" height="25" align="right">是否只能申请一次<br />（无论是否成功）：</td>
      <td>
          <?php echo $form->checkbox('g_products.only_apply_once'); ?>
          (仅新平台有效）
      </td>
    </tr>    
    <tr>
      <td width="20%" height="25" align="right">过期后是否出现在往期列表<br />：</td>
      <td>
          <?php echo $form->checkbox('g_products.in_wangqi_list'); ?>
          (仅新平台有效）
      </td>
    </tr>        
    
    <tr>
      <td  align="right">介绍：</td>
       <td><?php echo $form->textarea('g_products.g_description',array('style' => 'width:400px;height:260px'))?>
      </td>
    </tr>
    <tr>
      <td  align="right">规则介绍：<br /><b>仅新平台有效</b></td>
       <td><?php echo $form->textarea('g_products.g_notice_html',array('style' => 'width:400px;height:260px'))?>
      </td>
    </tr>    

    <tr>
      <td  align="right">附加问卷特殊功能(请勿随意修改)：</td>
       <td><?php echo $form->textarea('g_products.g_special_html',array('maxlength'=>'256000','style'=>'width:600px;height:180px')); ?>
      </td>
    </tr>
    <tr>
      <td height="25" align="right">&nbsp;</td>
      <td><input type="submit" name="submitbutton" value="修改" id="submitbutton" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="重置" /></td>
    </tr>
  </table>
</form>
<script type="text/javascript">
				//<![CDATA[
					CKEDITOR.replace( 'g_productsGDescription',{skin : 'office2003'} );
					CKEDITOR.replace( 'g_productsGNoticeHtml',{skin : 'office2003'} );
				//]]>
</script>


</body>
</html>
